<template>
  <van-tabs type="card" color="pink"  v-model="n" animated  >
  <van-tab v-for="item in nav" :key="item" :title="item" >
      <good-list v-if="arr.length>0" :arr="arr[n].content"></good-list>
  </van-tab>
  
</van-tabs>
</template>
<script>
import { getHomelist } from '../../../http/http'
export default {
    data() {
        return {
            nav:["热门推荐","上新推荐","所有商品"],
            arr:[],
            n:0
        }
    },
    // methods: {
    //     onClick(name,title){
    //        this.n=name
    //     }
    // },
    mounted() {
      getHomelist().then(res=>{
        //    console.log(res);
           this.arr=res.data.list
           console.log(this.arr);
       })
    },
}
</script>
<style >
/* .van-tabs__nav--card {
    margin: 0;
} */
.van-tabs__nav--card {
    margin: 0;
    width: 100%;
}
</style>